package com.lin.bank.feign;

import com.lin.bank.config.reponse.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@FeignClient(name = "bank-records")
public interface RecordsFeign {

    @GetMapping("/selectPage")
    Result selectPage(@RequestParam(name = "cardNo") String cardNo,
                      @RequestParam(name = "transactionDate1") String transactionDate1,
                      @RequestParam(name = "transactionDate2") String transactionDate2,
                      @RequestParam(name = "current", required = false, defaultValue = "1") Integer current,
                      @RequestParam(name = "size", required = false, defaultValue = "4") Integer size);

    @GetMapping("/sendMsg")
    @Transactional(propagation = Propagation.REQUIRED)
    String sendMsg(@RequestParam(name = "cardNo") String cardNo,
                   @RequestParam(name = "cardNo2")String cardNo2,
                   @RequestParam(name = "amount")Double amount,
                   @RequestParam(name = "balance1")Double balance1,
                   @RequestParam(name = "balance2")Double balance2);

}